
import {config} from './config' ;
export const http = function({data={},url,method="get"}){
    wx.showLoading({
      title: '数据正在请求中',
    })
    return new Promise((resolve,reject)=>{
        wx.request({
          url:config.baseUrl + url,
          data,
          method,
          success:res=>{
              console.log(res);
              resolve(res);
          },
          fail:err=>{
              console.log(err);
              reject(err);
          },
          complete:()=>{
              console.log('结果请求成功！！');
              wx.hideLoading()
          }
        })
    })
}